package com.ryan.day02.demo02;

import java.util.ArrayList;

public class DemoArrayStiudent {
    public static void main(String[] args) {
        Student one = new Student("zhangsan",23);
        Student two = new Student("lisi",25);

        ArrayList<Student> arrayList = new ArrayList<>();
        arrayList.add(one);
        arrayList.add(two);

        for (int i = 0; i < arrayList.size(); i++) {
            //获取到的是对象的地址值
            Student student = arrayList.get(i);
            String name = student.getName();
            int age = student.getAge();
            System.out.println("学生姓名是"+name+"年龄:"+age);
        }
     }
}
